<template>
    <div class="nest">
        <h1>这是BBBB</h1>
        <button @click="changeFlag">派发</button>
    </div>
</template>

<script setup lang="ts">
// import Bus from '../../Bus'
// let flag = false
// const changeFlag = () => {
//     flag = !flag
//     Bus.emit('on-click', flag)
// }

import { getCurrentInstance } from 'vue'

const instance = getCurrentInstance();   // 获取当前vue实例

let flag = false
const changeFlag = () => {
    flag = !flag
    instance?.proxy?.$Mit.emit('on-sss', flag)
    // instance?.proxy?.$Mit.emit('on-aaa', 'mitt')
}

</script>

<style scoped>
.nest {
    width: 200px;
    height: 200px;
    padding: 10px;
    background-color: gainsboro;
    color: white;
}
</style>